package com.aids_malaria.db.dao;

import android.arch.persistence.room.Dao;
import android.arch.persistence.room.Delete;
import android.arch.persistence.room.Insert;
import android.arch.persistence.room.OnConflictStrategy;
import android.arch.persistence.room.Query;

import com.aids_malaria.http.response.EaProcessPack;

import java.util.List;

@Dao
public interface EaProcessPackDao {
    @Query("delete from eaProcessPack")
    int deleteAll();

    @Delete
    int delete(EaProcessPack eaProcessPack);

    @Query("SELECT * FROM eaProcessPack")
    List<EaProcessPack> getAll();

    @Query("SELECT * FROM eaProcessPack WHERE createOrUpdate =:isCreateUpdate")
    List<EaProcessPack> getAllByCreateUpdate(boolean isCreateUpdate);

    @Query("SELECT * FROM eaProcessPack WHERE identity_code IN (:identity_code)")
    List<EaProcessPack> findById(String identity_code);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    List<Long> insertAll(List<EaProcessPack> users);

    @Insert(onConflict = OnConflictStrategy.REPLACE)
    Long insert(EaProcessPack users);
}

